package com.engine.view;

import java.io.IOException;

import com.ressource.ProcessLauncher;
import com.ressource.ProcessLauncherException;

/**
 * @author jonathan
 * @author fabienne
 */
public final class Terminal
{

	/**
	 * 
	 */
	private String			backgroundColor	= "black";
	/**
	 * 
	 */
	private String			foregroundColor	= "green";
	/**
	 * 
	 */
	private Integer			height			= 100;
	/**
	 * 
	 */
	private Integer			width			= 70;
	/**
	 * 
	 */
	private ProcessLauncher	xterm			= new ProcessLauncher();

	/**
	 * 
	 */
	public Terminal()
	{

	}

	/**
	 * @param backgroundColor
	 * @param foregroundColor
	 * @param height
	 * @param width
	 */
	public Terminal(String backgroundColor, String foregroundColor,
			Integer height, Integer width)
	{
		this.backgroundColor = backgroundColor;
		this.foregroundColor = foregroundColor;
		this.height = height;
		this.width = width;
	}

	/**
	 * 
	 */
	public void start()
	{
		try
		{
			xterm.execute("xterm -bg " + backgroundColor + " -fg "
					+ foregroundColor + " -geometry " + height + "x" + width
					+ " -e java com/engine/controller.Controller");
		}
		catch (IOException e)
		{
			e.printStackTrace();
		}
		catch (ProcessLauncherException e)
		{
			e.printStackTrace();
		}
	}

	/**
	 * @param backgroundColor
	 */
	public void setBackgroundColor(String backgroundColor)
	{
		this.backgroundColor = backgroundColor;
	}

	/**
	 * @return
	 */
	public String getBackgroundColor()
	{
		return backgroundColor;
	}

	/**
	 * @return
	 */
	public Integer getHeight()
	{
		return height;
	}

	/**
	 * @param height
	 */
	public void setHeight(Integer height)
	{
		this.height = height;
	}

	/**
	 * @return
	 */
	public Integer getWidth()
	{
		return width;
	}

	/**
	 * @param width
	 */
	public void setWidth(Integer width)
	{
		this.width = width;
	}

	/**
	 * @param foregroundColor
	 */
	public void setforegroundColor(String foregroundColor)
	{
		this.foregroundColor = foregroundColor;
	}

	/**
	 * @return
	 */
	public String getforegroundColor()
	{
		return foregroundColor;
	}

}
